---
title: SAIF.Application.Claim.Legal architecture
summary: Architectural responsibilities, boundaries, and interaction patterns.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-21
library: SAIF.Application.Claim.Legal
reference_type: embedded
---

# SAIF.Application.Claim.Legal architecture

`SAIF.Application.Claim.Legal` is the application layer at the top of the SAIF BOF stack for this repository. It orchestrates business objects from `SAIF.Business.*`, applies AD-group and confidential-claim security gating, coordinates transactional writes, and exposes a coarse-grained, UI-friendly manager API consumed directly by the `LegalMaintenance` WebForms front end and, through its `LegalNet\` folder, by the separate LegalNet application.

## Responsibilities
- Context management — resolve claim/legal-case context from a claim number, WCB number, or DCBS number.
- Security gating — AD group checks and confidential/exposure claim suppression before data is exposed.
- Aggregation — lazily load and cache business collections for UI binding.
- Orchestration of writes — save child collections in order, run pre/post-save processing, create downstream tasks/letters/batch jobs.
- A small amount of direct data access for lookup/dropdown lists (inline SQL executed through the inherited data layer).

## Component boundaries
- `LegalManagerBase` (abstract base, extends `ClaimAppManager`): shared context-resolution, security-gating, caching, and letter-request logic for all concrete managers.
- 20 concrete `cls*Manager` types (e.g. `clsAttorneyTableManager`, `clsLegalPersonManager`, `clsHearingLocationManager`, `clsMaintenanceManager`): application-layer managers each owning maintenance for one legal-domain entity.
- `LegalNet\` folder (17 managers, ≈2,266 lines): a distinct sub-boundary that compiles into this assembly but is not referenced by the `LegalMaintenance` web app in this repository; it serves the separate LegalNet application.*
- `clsCodeList`: a local value/DTO helper with no base type.
- `Institutions` (typed `DataSet`, designer-generated): local data-shape helper over a framework-standard base.
- `clsLegalData.vb`: present on disk but not compiled in this repository (no `<Compile Include>` entry); the runtime type resolved for `m_HeaderData` therefore comes from a referenced assembly or NuGet package, not this project's own compiled sources.**

## Interaction model
- Upward: consumed by `LegalMaintenance\` (WebForms pages/code-behind), which references only 4 of the 21 managers (`clsMaintenanceManager`, `clsLegalPersonManager`, `clsAttorneyTableManager`, `clsHearingLocationManager`); the `LegalNet\` folder's 17 managers are not referenced by this repository's front end.*
- Downward: `SAIF.Business.*` business objects and `SAIF.Services.*` services; Oracle via the inherited `DataLayer` / `SqlHelper`.
- Common instantiation pattern: every manager constructor takes `(inDatabase As String, inSecurityPrincipal As clsSecurityPrincipal)`, calls `MyBase.New`, which sets `DataLayer.Database = inDatabase`, `DataLayer.DBUser = "LGN"`, then calls `Initialize()`.
- Leaky boundary: `System.Web.HttpContext.Current.Cache` is used directly inside this class library (private `AddToCache` helpers), creating an ASP.NET runtime dependency in a non-web assembly; direct inline SQL for lookup/dropdown lists also bypasses the business-object layer.

## Architecture diagram
The following diagram shows high-level component interactions from the LegalMaintenance web app down through this library to business objects, services, and the database.

```mermaid
flowchart TD
	UI[LegalMaintenance WebForms] --> LMB[LegalManagerBase]
	LN[LegalNet application] --> LNM[LegalNet managers]
	LMB --> CM[Concrete cls*Manager types]
	LNM --> CM
	CM --> BIZ["SAIF.Business.Claim /<br>SAIF.Business.Claim.Legal"]
	CM --> TASKS["SAIF.Business.Tasks /<br>SAIF.Business.Tasks.Claim"]
	CM --> POLICY[SAIF.Business.View.Policy]
	CM --> APPWORX[SAIF.Services.Appworx]
	CM --> PRINT[SAIF.Services.Printing]
	CM --> DL["Inherited DataLayer /<br>SqlHelper"]
	DL --> ORA[(Oracle database)]
	CM --> CACHE[System.Web.HttpContext.Current.Cache]
```

## Sequence diagram
The following diagram shows the primary confidential-claim retrieval and security-gating sequence performed by `LegalManagerBase.OnRetrieve`.

```mermaid
sequenceDiagram
	participant Client as LegalMaintenance UI
	participant Manager as LegalManagerBase
	participant Security as clsSecurityPrincipal
	participant Claim as ClaimData
	Client->>Manager: Retrieve(claim context)
	Manager->>Claim: IsWorkerConflict / IsExposure
	Manager->>Security: IsAuthorized(LNConflict / LNExposure / LNAdmin)
	Security-->>Manager: Authorization result
	Manager-->>Client: Data (allowed) or ERRORCONFIDENTIALCLAIM (denied, CanViewClaim = False)
```

## Design constraints
- All legal data access in this library runs as database user `LGN`, hard-coded in `LegalManagerBase.New` (`DataLayer.DBUser = "LGN"`).
- This library is not packaged/published as a NuGet package by this repository's pipelines; it is built only as a project reference of the `LegalMaintenance` web application (`LegalMaintenance.sln`).
- Direct use of `System.Web.HttpContext.Current.Cache` couples this class library to an ASP.NET runtime context.
- `clsLegalData.vb` exists on disk but is excluded from compilation in every `.vbproj` in the repository; its compiled counterpart's origin cannot be confirmed from source.**
- Cross-reference gaps: `SAIF.Business.Claim.Legal` and `SAIF.Services.Printing` analyses were not available at analysis time, so business-object semantics and printing behaviour behind `PrintDEF` are not corroborated.**

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Business rules](business-rules.md)
- [Security and authorization](security-authorization.md)
- [Database tables](database-tables.md)
- [SQL catalog](sql/index.md)
- [API reference](api/index.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- SAIF.Application.Claim.Legal\SAIF.Application.Claim.Legal.vbproj
- SAIF.Application.Claim.Legal\LegalManagerBase.vb
- SAIF.Application.Claim.Legal\clsAttorneyTableManager.vb
- SAIF.Application.Claim.Legal\clsHearingLocationManager.vb
- SAIF.Application.Claim.Legal\clsLegalPersonManager.vb
- SAIF.Application.Claim.Legal\clsMaintenanceManager.vb
- SAIF.Application.Claim.Legal\clsLegalData.vb (not compiled)
- SAIF.Application.Claim.Legal\Institutions.Designer.vb
- SAIF.Application.Claim.Legal\LegalNet\clsAssignmentManager.vb
- SAIF.Application.Claim.Legal\LegalNet\clsCaseSearchManager.vb
- SAIF.Application.Claim.Legal\LegalNet\clsCaseNotesManager.vb
- SAIF.Application.Claim.Legal\LegalNet\clsOutcomeManager.vb
- SAIF.Application.Claim.Legal\LegalNet\clsScheduleManager.vb
- SAIF.Application.Claim\ClaimAppManager.vb
- SAIF.Application\AppManagerBase.vb
- Pipelines\build.yml
- `SAIF.Application.Claim.Legal/LegalManagerBase.vb`
- `SAIF.Application.Claim.Legal/clsAttorneyTableManager.vb`
- `SAIF.Application.Claim.Legal/clsHearingLocationManager.vb`
- `SAIF.Application.Claim.Legal/clsLegalPersonManager.vb`
- `SAIF.Application.Claim.Legal/clsMaintenanceManager.vb`
- `SAIF.Application.Claim.Legal/LegalNet/clsAssignmentManager.vb`
